home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 25 / Cream of the Crop 25.iso / doom / quake_ad.zip / HOLOGRAM.ZIP / SOURCE / CLIENT.QC next >
Text File  |  1997-02-13  |  35KB  |  1,482 lines

  1.  
  2. // prototypes
  3. void () W_WeaponFrame;
  4. void() W_SetCurrentAmmo;
  5. void() player_pain;
  6. void() player_stand1;
  7. void (vector org) spawn_tfog;
  8. void (vector org, entity death_owner) spawn_tdeath;
  9.  
  10. float    modelindex_eyes, modelindex_player;
  11. .float    MOTDD;
  12.  
  13. // MOTD, display this when a player connects
  14.  
  15. void() MOTD =
  16. {
  17.     // Modify the next line to change logon message
  18.     centerprint(self, "\n\n Welcome to [╫σ┌]'s QuakeServer \nCurrently running [╫σ┌]-Holo v1.3\n\nImpulse 15 toggles hologram\nImpulse 20 detonates hologram");
  19.     self.MOTDD = self.MOTDD + 1;
  20. };
  21.  
  22. /*
  23. =============================================================================
  24.  
  25.                 LEVEL CHANGING / INTERMISSION
  26.  
  27. =============================================================================
  28. */
  29.  
  30. float    intermission_running;
  31. float    intermission_exittime;
  32.  
  33. /*QUAKED info_intermission (1 0.5 0.5) (-16 -16 -16) (16 16 16)
  34. This is the camera point for the intermission.
  35. Use mangle instead of angle, so you can set pitch or roll as well as yaw.  'pitch roll yaw'
  36. */
  37. void() info_intermission =
  38. {
  39. };
  40.  
  41.  
  42.  
  43. void() SetChangeParms =
  44. {
  45.     if (self.health <= 0)
  46.     {
  47.         SetNewParms ();
  48.         return;
  49.     }
  50.  
  51. // remove items
  52.     self.items = self.items - (self.items & 
  53.     (IT_KEY1 | IT_KEY2 | IT_INVISIBILITY | IT_INVULNERABILITY | IT_SUIT | IT_QUAD) );
  54. // Added for Hologram Code
  55.     remove(self.hologram);
  56.  
  57. // cap super health
  58.     if (self.health > 100)
  59.         self.health = 100;
  60.     if (self.health < 50)
  61.         self.health = 50;
  62.     parm1 = self.items;
  63.     parm2 = self.health;
  64.     parm3 = self.armorvalue;
  65.     if (self.ammo_shells < 25)
  66.         parm4 = 25;
  67.     else
  68.         parm4 = self.ammo_shells;
  69.     parm5 = self.ammo_nails;
  70.     parm6 = self.ammo_rockets;
  71.     parm7 = self.ammo_cells;
  72.     parm8 = self.weapon;
  73.     parm9 = self.armortype * 100;
  74. };
  75.  
  76. void() SetNewParms =
  77. {
  78.     parm1 = IT_SHOTGUN | IT_AXE;
  79.     parm2 = 100;
  80.     parm3 = 0;
  81.     parm4 = 25;
  82.     parm5 = 0;
  83.     parm6 = 0;
  84.     parm7 = 0;
  85.     parm8 = 1;
  86.     parm9 = 0;
  87. };
  88.  
  89. void() DecodeLevelParms =
  90. {
  91.     if (serverflags)
  92.     {
  93.         if (world.model == "maps/start.bsp")
  94.             SetNewParms ();        // take away all stuff on starting new episode
  95.     }
  96.     
  97.     self.items = parm1;
  98.     self.health = parm2;
  99.     self.armorvalue = parm3;
  100.     self.ammo_shells = parm4;
  101.     self.ammo_nails = parm5;
  102.     self.ammo_rockets = parm6;
  103.     self.ammo_cells = parm7;
  104.     self.weapon = parm8;
  105.     self.armortype = parm9 * 0.01;
  106. };
  107.  
  108. /*
  109. ============
  110. FindIntermission
  111.  
  112. Returns the entity to view from
  113. ============
  114. */
  115. entity() FindIntermission =
  116. {
  117.     local    entity spot;
  118.     local    float cyc;
  119.  
  120. // look for info_intermission first
  121.     spot = find (world, classname, "info_intermission");
  122.     if (spot)
  123.     {    // pick a random one
  124.         cyc = random() * 4;
  125.         while (cyc > 1)
  126.         {
  127.             spot = find (spot, classname, "info_intermission");
  128.             if (!spot)
  129.                 spot = find (spot, classname, "info_intermission");
  130.             cyc = cyc - 1;
  131.         }
  132.         return spot;
  133.     }
  134.  
  135. // then look for the start position
  136.     spot = find (world, classname, "info_player_start");
  137.     if (spot)
  138.         return spot;
  139.     
  140. // testinfo_player_start is only found in regioned levels
  141.     spot = find (world, classname, "testplayerstart");
  142.     if (spot)
  143.         return spot;
  144.     
  145.     objerror ("FindIntermission: no spot");
  146. };
  147.  
  148.  
  149. string nextmap;
  150. void() GotoNextMap =
  151. {
  152.     if (cvar("samelevel"))    // if samelevel is set, stay on same level
  153.         changelevel (mapname);
  154.     else
  155.         changelevel (nextmap);
  156. };
  157.  
  158.  
  159. void() ExitIntermission =
  160. {
  161. // skip any text in deathmatch
  162.     if (deathmatch)
  163.     {
  164.         GotoNextMap ();
  165.         return;
  166.     }
  167.     
  168.     intermission_exittime = time + 1;
  169.     intermission_running = intermission_running + 1;
  170.  
  171. //
  172. // run some text if at the end of an episode
  173. //
  174.     if (intermission_running == 2)
  175.     {
  176.         if (world.model == "maps/e1m7.bsp")
  177.         {
  178.             WriteByte (MSG_ALL, SVC_CDTRACK);
  179.             WriteByte (MSG_ALL, 2);
  180.             WriteByte (MSG_ALL, 3);
  181.             if (!cvar("registered"))
  182.             {
  183.                 WriteByte (MSG_ALL, SVC_FINALE);
  184.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task in the other three\nhaunted lands of Quake. Or are you? If\nyou don't register Quake, you'll never\nknow what awaits you in the Realm of\nBlack Magic, the Netherworld, and the\nElder World!");
  185.             }
  186.             else
  187.             {
  188.                 WriteByte (MSG_ALL, SVC_FINALE);
  189.                 WriteString (MSG_ALL, "As the corpse of the monstrous entity\nChthon sinks back into the lava whence\nit rose, you grip the Rune of Earth\nMagic tightly. Now that you have\nconquered the Dimension of the Doomed,\nrealm of Earth Magic, you are ready to\ncomplete your task. A Rune of magic\npower lies at the end of each haunted\nland of Quake. Go forth, seek the\ntotality of the four Runes!");
  190.             }
  191.             return;
  192.         }
  193.         else if (world.model == "maps/e2m6.bsp")
  194.         {
  195.             WriteByte (MSG_ALL, SVC_CDTRACK);
  196.             WriteByte (MSG_ALL, 2);
  197.             WriteByte (MSG_ALL, 3);
  198.  
  199.             WriteByte (MSG_ALL, SVC_FINALE);
  200.             WriteString (MSG_ALL, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral.");
  201.             return;
  202.         }
  203.         else if (world.model == "maps/e3m6.bsp")
  204.         {
  205.             WriteByte (MSG_ALL, SVC_CDTRACK);
  206.             WriteByte (MSG_ALL, 2);
  207.             WriteByte (MSG_ALL, 3);
  208.  
  209.             WriteByte (MSG_ALL, SVC_FINALE);
  210.             WriteString (MSG_ALL, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth.");
  211.             return;
  212.         }
  213.         else if (world.model == "maps/e4m7.bsp")
  214.         {
  215.             WriteByte (MSG_ALL, SVC_CDTRACK);
  216.             WriteByte (MSG_ALL, 2);
  217.             WriteByte (MSG_ALL, 3);
  218.  
  219.             WriteByte (MSG_ALL, SVC_FINALE);
  220.             WriteString (MSG_ALL, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person.");
  221.             return;
  222.         }
  223.  
  224.         GotoNextMap();
  225.     }
  226.     
  227.     if (intermission_running == 3)
  228.     {
  229.         if (!cvar("registered"))
  230.         {    // shareware episode has been completed, go to sell screen
  231.             WriteByte (MSG_ALL, SVC_SELLSCREEN);
  232.             return;
  233.         }
  234.         
  235.         if ( (serverflags&15) == 15)
  236.         {
  237.             WriteByte (MSG_ALL, SVC_FINALE);
  238.             WriteString (MSG_ALL, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born.");
  239.             return;
  240.         }
  241.         
  242.     }
  243.  
  244.     GotoNextMap();
  245. };
  246.  
  247. /*
  248. ============
  249. IntermissionThink
  250.  
  251. When the player presses attack or jump, change to the next level
  252. ============
  253. */
  254. void() IntermissionThink =
  255. {
  256.     if (time < intermission_exittime)
  257.         return;
  258.  
  259.     if (!self.button0 && !self.button1 && !self.button2)
  260.         return;
  261.     
  262.     ExitIntermission ();
  263. };
  264.  
  265. void() execute_changelevel =
  266. {
  267.     local entity    pos;
  268.  
  269.     intermission_running = 1;
  270.     
  271. // enforce a wait time before allowing changelevel
  272.     if (deathmatch)
  273.         intermission_exittime = time + 5;
  274.     else
  275.         intermission_exittime = time + 2;
  276.  
  277.     WriteByte (MSG_ALL, SVC_CDTRACK);
  278.     WriteByte (MSG_ALL, 3);
  279.     WriteByte (MSG_ALL, 3);
  280.     
  281.     pos = FindIntermission ();
  282.  
  283.     other = find (world, classname, "player");
  284.     while (other != world)
  285.     {
  286.         other.view_ofs = '0 0 0';
  287.         other.angles = other.v_angle = pos.mangle;
  288.         other.fixangle = TRUE;        // turn this way immediately
  289.         other.nextthink = time + 0.5;
  290.         other.takedamage = DAMAGE_NO;
  291.         other.solid = SOLID_NOT;
  292.         other.movetype = MOVETYPE_NONE;
  293.         other.modelindex = 0;
  294.         setorigin (other, pos.origin);
  295.         other = find (other, classname, "player");
  296.     }    
  297.  
  298.     WriteByte (MSG_ALL, SVC_INTERMISSION);
  299. };
  300.  
  301.  
  302. void() changelevel_touch =
  303. {
  304.     local entity    pos;
  305.  
  306.     if (other.classname != "player")
  307.         return;
  308.  
  309.     if ((cvar("noexit") == 1) || ((cvar("noexit") == 2) && (mapname != "start")))
  310.     {
  311.         T_Damage (other, self, self, 50000);
  312.         return;
  313.     }
  314.  
  315.     if (coop || deathmatch)
  316.     {
  317.         bprint (other.netname);
  318.         bprint (" exited the level\n");
  319.     }
  320.     
  321.     nextmap = self.map;
  322.  
  323.     SUB_UseTargets ();
  324.  
  325.     if ( (self.spawnflags & 1) && (deathmatch == 0) )
  326.     {    // NO_INTERMISSION
  327.         GotoNextMap();
  328.         return;
  329.     }
  330.     
  331.     self.touch = SUB_Null;
  332.  
  333. // we can't move people right now, because touch functions are called
  334. // in the middle of C movement code, so set a think time to do it
  335.     self.think = execute_changelevel;
  336.     self.nextthink = time + 0.1;
  337. };
  338.  
  339. /*QUAKED trigger_changelevel (0.5 0.5 0.5) ? NO_INTERMISSION
  340. When the player touches this, he gets sent to the map listed in the "map" variable.  Unless the NO_INTERMISSION flag is set, the view will go to the info_intermission spot and display stats.
  341. */
  342. void() trigger_changelevel =
  343. {
  344.     if (!self.map)
  345.         objerror ("chagnelevel trigger doesn't have map");
  346.     
  347.     InitTrigger ();
  348.     self.touch = changelevel_touch;
  349. };
  350.  
  351.  
  352. /*
  353. =============================================================================
  354.  
  355.                 PLAYER GAME EDGE FUNCTIONS
  356.  
  357. =============================================================================
  358. */
  359.  
  360. void() set_suicide_frame;
  361.  
  362. // called by ClientKill and DeadThink
  363. void() respawn =
  364. {
  365.     if (coop)
  366.     {
  367.         // make a copy of the dead body for appearances sake
  368.         CopyToBodyQue (self);
  369.         // get the spawn parms as they were at level start
  370.         setspawnparms (self);
  371.         // respawn        
  372.         PutClientInServer ();
  373.     }
  374.     else if (deathmatch)
  375.     {
  376.         // make a copy of the dead body for appearances sake
  377.         CopyToBodyQue (self);
  378.         // set default spawn parms
  379.         SetNewParms ();
  380.         // respawn        
  381.         PutClientInServer ();
  382.     }
  383.     else
  384.     {    // restart the entire server
  385.         localcmd ("restart\n");
  386.     }
  387. };
  388.  
  389.  
  390. /*
  391. ============
  392. ClientKill
  393.  
  394. Player entered the suicide command
  395. ============
  396. */
  397. void() ClientKill =
  398. {
  399.     bprint (self.netname);
  400.     bprint (" suicides\n");
  401.     set_suicide_frame ();
  402.     self.modelindex = modelindex_player;
  403.     self.frags = self.frags - 2;    // extra penalty
  404.     respawn ();
  405. };
  406.  
  407. float(vector v) CheckSpawnPoint =
  408. {
  409.     return FALSE;
  410. };
  411.  
  412. /*
  413. ============
  414. SelectSpawnPoint
  415.  
  416. Returns the entity to spawn at
  417. ============
  418. */
  419. entity() SelectSpawnPoint =
  420. {
  421.     local    entity spot;
  422.     local    entity thing;
  423.     local    float  pcount;
  424.     
  425. // testinfo_player_start is only found in regioned levels
  426.     spot = find (world, classname, "testplayerstart");
  427.     if (spot)
  428.         return spot;
  429.         
  430. // choose a info_player_deathmatch point
  431.     if (coop)
  432.     {
  433.         lastspawn = find(lastspawn, classname, "info_player_coop");
  434.         if (lastspawn == world)
  435.             lastspawn = find (lastspawn, classname, "info_player_start");
  436.         if (lastspawn != world)
  437.             return lastspawn;
  438.     }
  439.     else if (deathmatch)
  440.     {
  441.         spot = lastspawn;
  442.         while (1)
  443.         {
  444.             spot = find(spot, classname, "info_player_deathmatch");
  445.             if (spot != world)
  446.             {
  447.                 if (spot == lastspawn)
  448.                     return lastspawn;
  449.                 pcount = 0;
  450.                 thing = findradius(spot.origin, 32);
  451.                 while(thing)
  452.                 {
  453.                     if (thing.classname == "player")
  454.                         pcount = pcount + 1;
  455.                     thing = thing.chain;
  456.                 }
  457.                 if (pcount == 0)
  458.                 {
  459.                     lastspawn = spot;
  460.                     return spot;
  461.                 }
  462.             }
  463.         }
  464.     }
  465.  
  466.     if (serverflags)
  467.     {    // return with a rune to start
  468.         spot = find (world, classname, "info_player_start2");
  469.         if (spot)
  470.             return spot;
  471.     }
  472.     
  473.     spot = find (world, classname, "info_player_start");
  474.     if (!spot)
  475.         error ("PutClientInServer: no info_player_start on level");
  476.     
  477.     return spot;
  478. };
  479.  
  480. /*
  481. ===========
  482. PutClientInServer
  483.  
  484. called each time a player is spawned
  485. ============
  486. */
  487. void() DecodeLevelParms;
  488. void() PlayerDie;
  489.  
  490.  
  491. void() PutClientInServer =
  492. {
  493.     local    entity spot;
  494.  
  495.     spot = SelectSpawnPoint ();
  496.  
  497.     self.classname = "player";
  498.     self.health = 100;
  499.     self.takedamage = DAMAGE_AIM;
  500.     self.solid = SOLID_SLIDEBOX;
  501.     self.movetype = MOVETYPE_WALK;
  502.     self.show_hostile = 0;
  503.     self.max_health = 100;
  504.     self.flags = FL_CLIENT;
  505.     self.air_finished = time + 12;
  506.     self.dmg = 2;           // initial water damage
  507.     self.super_damage_finished = 0;
  508.     self.radsuit_finished = 0;
  509.     self.invisible_finished = 0;
  510.     self.invincible_finished = 0;
  511.     self.effects = 0;
  512.     self.invincible_time = 0;
  513.     if (self.MOTDD < 1)
  514.         self.MOTDD = 0;
  515.  
  516.     DecodeLevelParms ();
  517.     
  518.     W_SetCurrentAmmo ();
  519.  
  520.     self.attack_finished = time;
  521.     self.th_pain = player_pain;
  522.     self.th_die = PlayerDie;
  523.     
  524.     self.deadflag = DEAD_NO;
  525. // paustime is set by teleporters to keep the player from moving a while
  526.     self.pausetime = 0;
  527.     
  528. //    spot = SelectSpawnPoint ();
  529.  
  530.     self.origin = spot.origin + '0 0 1';
  531.     self.angles = spot.angles;
  532.     self.fixangle = TRUE;        // turn this way immediately
  533.  
  534. // oh, this is a hack!
  535.     setmodel (self, "progs/eyes.mdl");
  536.     modelindex_eyes = self.modelindex;
  537.  
  538.     setmodel (self, "progs/player.mdl");
  539.     modelindex_player = self.modelindex;
  540.  
  541.     setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
  542.     
  543.     self.view_ofs = '0 0 22';
  544.  
  545.     player_stand1 ();
  546.     
  547.     if (deathmatch || coop)
  548.     {
  549.         makevectors(self.angles);
  550.         spawn_tfog (self.origin + v_forward*20);
  551.     }
  552.  
  553.     spawn_tdeath (self.origin, self);
  554.  
  555. };
  556.  
  557.  
  558. /*
  559. =============================================================================
  560.  
  561.                 QUAKED FUNCTIONS
  562.  
  563. =============================================================================
  564. */
  565.  
  566.  
  567. /*QUAKED info_player_start (1 0 0) (-16 -16 -24) (16 16 24)
  568. The normal starting point for a level.
  569. */
  570. void() info_player_start =
  571. {
  572. };
  573.  
  574.  
  575. /*QUAKED info_player_start2 (1 0 0) (-16 -16 -24) (16 16 24)
  576. Only used on start map for the return point from an episode.
  577. */
  578. void() info_player_start2 =
  579. {
  580. };
  581.  
  582.  
  583. /*
  584. saved out by quaked in region mode
  585. */
  586. void() testplayerstart =
  587. {
  588. };
  589.  
  590. /*QUAKED info_player_deathmatch (1 0 1) (-16 -16 -24) (16 16 24)
  591. potential spawning position for deathmatch games
  592. */
  593. void() info_player_deathmatch =
  594. {
  595. };
  596.  
  597. /*QUAKED info_player_coop (1 0 1) (-16 -16 -24) (16 16 24)
  598. potential spawning position for coop games
  599. */
  600. void() info_player_coop =
  601. {
  602. };
  603.  
  604. /*
  605. ===============================================================================
  606.  
  607. RULES
  608.  
  609. ===============================================================================
  610. */
  611.  
  612. /*
  613. go to the next level for deathmatch
  614. only called if a time or frag limit has expired
  615. */
  616. void() NextLevel =
  617. {
  618.     local entity o;
  619.  
  620.     if (mapname == "start")
  621.     {
  622.         if (!cvar("registered"))
  623.         {
  624.             mapname = "e1m1";
  625.         }
  626.         else if (!(serverflags & 1))
  627.         {
  628.             mapname = "e1m1";
  629.             serverflags = serverflags | 1;
  630.         }
  631.         else if (!(serverflags & 2))
  632.         {
  633.             mapname = "e2m1";
  634.             serverflags = serverflags | 2;
  635.         }
  636.         else if (!(serverflags & 4))
  637.         {
  638.             mapname = "e3m1";
  639.             serverflags = serverflags | 4;
  640.         }
  641.         else if (!(serverflags & 8))
  642.         {
  643.             mapname = "e4m1";
  644.             serverflags = serverflags - 7;
  645.         }
  646.  
  647.         o = spawn();
  648.         o.map = mapname;
  649.     }
  650.     else
  651.     {
  652.         // find a trigger changelevel
  653.         o = find(world, classname, "trigger_changelevel");
  654.  
  655.         // go back to start if no trigger_changelevel
  656.         if (!o)
  657.         {
  658.             mapname = "start";
  659.             o = spawn();
  660.             o.map = mapname;
  661.         }
  662.     }
  663.  
  664.     nextmap = o.map;
  665.     gameover = TRUE;
  666.     
  667.     if (o.nextthink < time)
  668.     {
  669.         o.think = execute_changelevel;
  670.         o.nextthink = time + 0.1;
  671.     }
  672. };
  673.  
  674. /*
  675. ============
  676. CheckRules
  677.  
  678. Exit deathmatch games upon conditions
  679. ============
  680. */
  681. void() CheckRules =
  682. {
  683.     local    float        timelimit;
  684.     local    float        fraglimit;
  685.     
  686.     if (gameover)    // someone else quit the game already
  687.         return;
  688.         
  689.     timelimit = cvar("timelimit") * 60;
  690.     fraglimit = cvar("fraglimit");
  691.     
  692.     if (timelimit && time >= timelimit)
  693.     {
  694.         NextLevel ();
  695.         return;
  696.     }
  697.     
  698.     if (fraglimit && self.frags >= fraglimit)
  699.     {
  700.         NextLevel ();
  701.         return;
  702.     }    
  703. };
  704.  
  705. //============================================================================
  706.  
  707. void() PlayerDeathThink =
  708. {
  709.     local entity    old_self;
  710.     local float        forward;
  711.  
  712.     if ((self.flags & FL_ONGROUND))
  713.     {
  714.         forward = vlen (self.velocity);
  715.         forward = forward - 20;
  716.         if (forward <= 0)
  717.             self.velocity = '0 0 0';
  718.         else    
  719.             self.velocity = forward * normalize(self.velocity);
  720.     }
  721.  
  722. // wait for all buttons released
  723.     if (self.deadflag == DEAD_DEAD)
  724.     {
  725.         if (self.button2 || self.button1 || self.button0)
  726.             return;
  727.         self.deadflag = DEAD_RESPAWNABLE;
  728.         return;
  729.     }
  730.  
  731. // wait for any button down
  732.     if (!self.button2 && !self.button1 && !self.button0)
  733.         return;
  734.  
  735.     self.button0 = 0;
  736.     self.button1 = 0;
  737.     self.button2 = 0;
  738.     respawn();
  739. };
  740.  
  741.  
  742. void() PlayerJump =
  743. {
  744.     local vector start, end;
  745.     
  746.     if (self.flags & FL_WATERJUMP)
  747.         return;
  748.     
  749.     if (self.waterlevel >= 2)
  750.     {
  751.         if (self.watertype == CONTENT_WATER)
  752.             self.velocity_z = 100;
  753.         else if (self.watertype == CONTENT_SLIME)
  754.             self.velocity_z = 80;
  755.         else
  756.             self.velocity_z = 50;
  757.  
  758. // play swiming sound
  759.         if (self.swim_flag < time)
  760.         {
  761.             self.swim_flag = time + 1;
  762.             if (random() < 0.5)
  763.                 sound (self, CHAN_BODY, "misc/water1.wav", 1, ATTN_NORM);
  764.             else
  765.                 sound (self, CHAN_BODY, "misc/water2.wav", 1, ATTN_NORM);
  766.         }
  767.  
  768.         return;
  769.     }
  770.  
  771.     if (!(self.flags & FL_ONGROUND))
  772.         return;
  773.  
  774.     if ( !(self.flags & FL_JUMPRELEASED) )
  775.         return;        // don't pogo stick
  776.  
  777.     self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  778.  
  779.     self.flags = self.flags - FL_ONGROUND;    // don't stairwalk
  780.     
  781.     self.button2 = 0;
  782. // player jumping sound
  783.     sound (self, CHAN_BODY, "player/plyrjmp8.wav", 1, ATTN_NORM);
  784.     self.velocity_z = self.velocity_z + 270;
  785. };
  786.  
  787.  
  788. /*
  789. ===========
  790. WaterMove
  791.  
  792. ============
  793. */
  794. .float    dmgtime;
  795.  
  796. void() WaterMove =
  797. {
  798. //dprint (ftos(self.waterlevel));
  799.     if (self.movetype == MOVETYPE_NOCLIP)
  800.         return;
  801.     if (self.health < 0)
  802.         return;
  803.  
  804.     if (self.waterlevel != 3)
  805.     {
  806.         if (self.air_finished < time)
  807.             sound (self, CHAN_VOICE, "player/gasp2.wav", 1, ATTN_NORM);
  808.         else if (self.air_finished < time + 9)
  809.             sound (self, CHAN_VOICE, "player/gasp1.wav", 1, ATTN_NORM);
  810.         self.air_finished = time + 12;
  811.         self.dmg = 2;
  812.     }
  813.     else if (self.air_finished < time)
  814.     {    // drown!
  815.         if (self.pain_finished < time)
  816.         {
  817.             self.dmg = self.dmg + 2;
  818.             if (self.dmg > 15)
  819.                 self.dmg = 10;
  820.             T_Damage (self, world, world, self.dmg);
  821.             self.pain_finished = time + 1;
  822.         }
  823.     }
  824.     
  825.     if (!self.waterlevel)
  826.     {
  827.         if (self.flags & FL_INWATER)
  828.         {    
  829.             // play leave water sound
  830.             sound (self, CHAN_BODY, "misc/outwater.wav", 1, ATTN_NORM);
  831.             self.flags = self.flags - FL_INWATER;
  832.         }
  833.         return;
  834.     }
  835.  
  836.     if (self.watertype == CONTENT_LAVA)
  837.     {    // do damage
  838.         if (self.dmgtime < time)
  839.         {
  840.             if (self.radsuit_finished > time)
  841.                 self.dmgtime = time + 1;
  842.             else
  843.                 self.dmgtime = time + 0.2;
  844.  
  845.             T_Damage (self, world, world, 10*self.waterlevel);
  846.         }
  847.     }
  848.     else if (self.watertype == CONTENT_SLIME)
  849.     {    // do damage
  850.         if (self.dmgtime < time && self.radsuit_finished < time)
  851.         {
  852.             self.dmgtime = time + 1;
  853.             T_Damage (self, world, world, 4*self.waterlevel);
  854.         }
  855.     }
  856.     
  857.     if ( !(self.flags & FL_INWATER) )
  858.     {    
  859.  
  860. // player enter water sound
  861.  
  862.         if (self.watertype == CONTENT_LAVA)
  863.             sound (self, CHAN_BODY, "player/inlava.wav", 1, ATTN_NORM);
  864.         if (self.watertype == CONTENT_WATER)
  865.             sound (self, CHAN_BODY, "player/inh2o.wav", 1, ATTN_NORM);
  866.         if (self.watertype == CONTENT_SLIME)
  867.             sound (self, CHAN_BODY, "player/slimbrn2.wav", 1, ATTN_NORM);
  868.  
  869.         self.flags = self.flags + FL_INWATER;
  870.         self.dmgtime = 0;
  871.     }
  872.     
  873.     if (! (self.flags & FL_WATERJUMP) )
  874.         self.velocity = self.velocity - 0.8*self.waterlevel*frametime*self.velocity;
  875. };
  876.  
  877. void() CheckWaterJump =
  878. {
  879.     local vector start, end;
  880.  
  881. // check for a jump-out-of-water
  882.     makevectors (self.angles);
  883.     start = self.origin;
  884.     start_z = start_z + 8; 
  885.     v_forward_z = 0;
  886.     normalize(v_forward);
  887.     end = start + v_forward*24;
  888.     traceline (start, end, TRUE, self);
  889.     if (trace_fraction < 1)
  890.     {    // solid at waist
  891.         start_z = start_z + self.maxs_z - 8;
  892.         end = start + v_forward*24;
  893.         self.movedir = trace_plane_normal * -50;
  894.         traceline (start, end, TRUE, self);
  895.         if (trace_fraction == 1)
  896.         {    // open at eye level
  897.             self.flags = self.flags | FL_WATERJUMP;
  898.             self.velocity_z = 225;
  899.             self.flags = self.flags - (self.flags & FL_JUMPRELEASED);
  900.             self.teleport_time = time + 2;    // safety net
  901.             return;
  902.         }
  903.     }
  904. };
  905.  
  906.  
  907. /*
  908. ================
  909. PlayerPreThink
  910.  
  911. Called every frame before physics are run
  912. ================
  913. */
  914. void() PlayerPreThink =
  915. {
  916.     local    float    mspeed, aspeed;
  917.     local    float    r;
  918.  
  919.     if (intermission_running)
  920.     {
  921.         IntermissionThink ();    // otherwise a button could be missed between
  922.         return;                    // the think tics
  923.     }
  924.  
  925.     if (self.view_ofs == '0 0 0')
  926.         return;        // intermission or finale
  927.  
  928.     if (self.MOTDD < 90)
  929.         MOTD ();
  930.  
  931.     makevectors (self.v_angle);        // is this still used
  932.  
  933.     CheckRules ();
  934.     WaterMove ();
  935.  
  936.     if (self.waterlevel == 2)
  937.         CheckWaterJump ();
  938.  
  939.     if (self.deadflag >= DEAD_DEAD)
  940.     {
  941.         PlayerDeathThink ();
  942.         return;
  943.     }
  944.     
  945.     if (self.deadflag == DEAD_DYING)
  946.         return;    // dying, so do nothing
  947.  
  948.     if (self.button2)
  949.     {
  950.         PlayerJump ();
  951.     }
  952.     else
  953.         self.flags = self.flags | FL_JUMPRELEASED;
  954.  
  955. // teleporters can force a non-moving pause time    
  956.     if (time < self.pausetime)
  957.         self.velocity = '0 0 0';
  958.  
  959.     if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
  960.     {
  961.         self.weapon = W_BestWeapon ();
  962.         W_SetCurrentAmmo ();
  963.     }
  964. };
  965.     
  966. /*
  967. ================
  968. CheckPowerups
  969.  
  970. Check for turning off powerups
  971. ================
  972. */
  973. void() CheckPowerups =
  974. {
  975.     if (self.health <= 0)
  976.         return;
  977.  
  978. // invisibility
  979.     if (self.invisible_finished)
  980.     {
  981. // sound and screen flash when items starts to run out
  982.         if (self.invisible_sound < time)
  983.         {
  984.             sound (self, CHAN_AUTO, "items/inv3.wav", 0.5, ATTN_IDLE);
  985.             self.invisible_sound = time + ((random() * 3) + 1);
  986.         }
  987.  
  988.  
  989.         if (self.invisible_finished < time + 3)
  990.         {
  991.             if (self.invisible_time == 1)
  992.             {
  993.                 sprint (self, "Ring of Shadows magic is fading\n");
  994.                 stuffcmd (self, "bf\n");
  995.                 sound (self, CHAN_AUTO, "items/inv2.wav", 1, ATTN_NORM);
  996.                 self.invisible_time = time + 1;
  997.             }
  998.             
  999.             if (self.invisible_time < time)
  1000.             {
  1001.                 self.invisible_time = time + 1;
  1002.                 stuffcmd (self, "bf\n");
  1003.             }
  1004.         }
  1005.  
  1006.         if (self.invisible_finished < time)
  1007.         {    // just stopped
  1008.             self.items = self.items - IT_INVISIBILITY;
  1009.             self.invisible_finished = 0;
  1010.             self.invisible_time = 0;
  1011.         }
  1012.         
  1013.     // use the eyes
  1014.         self.frame = 0;
  1015.         self.modelindex = modelindex_eyes;
  1016.     }
  1017.     else
  1018.         self.modelindex = modelindex_player;    // don't use eyes
  1019.  
  1020. // invincibility
  1021.     if (self.invincible_finished)
  1022.     {
  1023. // sound and screen flash when items starts to run out
  1024.         if (self.invincible_finished < time + 3)
  1025.         {
  1026.             if (self.invincible_time == 1)
  1027.             {
  1028.                 sprint (self, "Protection is almost burned out\n");
  1029.                 stuffcmd (self, "bf\n");
  1030.                 sound (self, CHAN_AUTO, "items/protect2.wav", 1, ATTN_NORM);
  1031.                 self.invincible_time = time + 1;
  1032.             }
  1033.             
  1034.             if (self.invincible_time < time)
  1035.             {
  1036.                 self.invincible_time = time + 1;
  1037.                 stuffcmd (self, "bf\n");
  1038.             }
  1039.         }
  1040.         
  1041.         if (self.invincible_finished < time)
  1042.         {    // just stopped
  1043.             self.items = self.items - IT_INVULNERABILITY;
  1044.             self.invincible_time = 0;
  1045.             self.invincible_finished = 0;
  1046.         }
  1047.         if (self.invincible_finished > time)
  1048.             self.effects = self.effects | EF_DIMLIGHT;
  1049.         else
  1050.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1051.     }
  1052.  
  1053. // super damage
  1054.     if (self.super_damage_finished)
  1055.     {
  1056.  
  1057. // sound and screen flash when items starts to run out
  1058.  
  1059.         if (self.super_damage_finished < time + 3)
  1060.         {
  1061.             if (self.super_time == 1)
  1062.             {
  1063.                 sprint (self, "Quad Damage is wearing off\n");
  1064.                 stuffcmd (self, "bf\n");
  1065.                 sound (self, CHAN_AUTO, "items/damage2.wav", 1, ATTN_NORM);
  1066.                 self.super_time = time + 1;
  1067.             }      
  1068.             
  1069.             if (self.super_time < time)
  1070.             {
  1071.                 self.super_time = time + 1;
  1072.                 stuffcmd (self, "bf\n");
  1073.             }
  1074.         }
  1075.  
  1076.         if (self.super_damage_finished < time)
  1077.         {    // just stopped
  1078.             self.items = self.items - IT_QUAD;
  1079.             self.super_damage_finished = 0;
  1080.             self.super_time = 0;
  1081.         }
  1082.         if (self.super_damage_finished > time)
  1083.             self.effects = self.effects | EF_DIMLIGHT;
  1084.         else
  1085.             self.effects = self.effects - (self.effects & EF_DIMLIGHT);
  1086.     }    
  1087.  
  1088. // suit    
  1089.     if (self.radsuit_finished)
  1090.     {
  1091.         self.air_finished = time + 12;        // don't drown
  1092.  
  1093. // sound and screen flash when items starts to run out
  1094.         if (self.radsuit_finished < time + 3)
  1095.         {
  1096.             if (self.rad_time == 1)
  1097.             {
  1098.                 sprint (self, "Air supply in Biosuit expiring\n");
  1099.                 stuffcmd (self, "bf\n");
  1100.                 sound (self, CHAN_AUTO, "items/suit2.wav", 1, ATTN_NORM);
  1101.                 self.rad_time = time + 1;
  1102.             }
  1103.             
  1104.             if (self.rad_time < time)
  1105.             {
  1106.                 self.rad_time = time + 1;
  1107.                 stuffcmd (self, "bf\n");
  1108.             }
  1109.         }
  1110.  
  1111.         if (self.radsuit_finished < time)
  1112.         {    // just stopped
  1113.             self.items = self.items - IT_SUIT;
  1114.             self.rad_time = 0;
  1115.             self.radsuit_finished = 0;
  1116.         }
  1117.     }    
  1118.  
  1119. };
  1120.  
  1121.  
  1122. /*
  1123. ================
  1124. PlayerPostThink
  1125.  
  1126. Called every frame after physics are run
  1127. ================
  1128. */
  1129. void() PlayerPostThink =
  1130. {
  1131.     local    float    mspeed, aspeed;
  1132.     local    float    r;
  1133.  
  1134.     if (self.view_ofs == '0 0 0')
  1135.         return;        // intermission or finale
  1136.     if (self.deadflag)
  1137.         return;
  1138.         
  1139. // do weapon stuff
  1140.  
  1141.     W_WeaponFrame ();
  1142.  
  1143. // check to see if player landed and play landing sound    
  1144.     if ((self.jump_flag < -300) && (self.flags & FL_ONGROUND) && (self.health > 0))
  1145.     {
  1146.         if (self.watertype == CONTENT_WATER)
  1147.             sound (self, CHAN_BODY, "player/h2ojump.wav", 1, ATTN_NORM);
  1148.         else if (self.jump_flag < -650)
  1149.         {
  1150.             T_Damage (self, world, world, 5); 
  1151.             sound (self, CHAN_VOICE, "player/land2.wav", 1, ATTN_NORM);
  1152.             self.deathtype = "falling";
  1153.         }
  1154.         else
  1155.             sound (self, CHAN_VOICE, "player/land.wav", 1, ATTN_NORM);
  1156.  
  1157.         self.jump_flag = 0;
  1158.     }
  1159.  
  1160.     if (!(self.flags & FL_ONGROUND))
  1161.         self.jump_flag = self.velocity_z;
  1162.  
  1163.     CheckPowerups ();
  1164. };
  1165.  
  1166.  
  1167. /*
  1168. ===========
  1169. ClientConnect
  1170.  
  1171. called when a player connects to a server
  1172. ============
  1173. */
  1174. void() ClientConnect =
  1175. {
  1176.     bprint (self.netname);
  1177.     bprint (" entered the game\n");
  1178.     
  1179. // a client connecting during an intermission can cause problems
  1180.     if (intermission_running)
  1181.         ExitIntermission ();
  1182. };
  1183.  
  1184.  
  1185. /*
  1186. ===========
  1187. ClientDisconnect
  1188.  
  1189. called when a player disconnects from a server
  1190. ============
  1191. */
  1192. void() ClientDisconnect =
  1193. {
  1194.     if (gameover)
  1195.         return;
  1196.     // if the level end trigger has been activated, just return
  1197.     // since they aren't *really* leaving
  1198.  
  1199.     // let everyone else know
  1200.     bprint (self.netname);
  1201.     bprint (" left the game with ");
  1202.     bprint (ftos(self.frags));
  1203.     bprint (" frags\n");
  1204.     sound (self, CHAN_BODY, "player/tornoff2.wav", 1, ATTN_NONE);
  1205.     set_suicide_frame ();
  1206. };
  1207.  
  1208. /*
  1209. ===========
  1210. ClientObituary
  1211.  
  1212. called when a player dies
  1213. ============
  1214. */
  1215. void(entity targ, entity attacker) ClientObituary =
  1216. {
  1217.     local    float rnum;
  1218.     local    string deathstring, deathstring2;
  1219.     rnum = random();
  1220.  
  1221.     if (targ.classname == "player")
  1222.     {
  1223.         if (attacker.classname == "teledeath")
  1224.         {
  1225.             bprint (targ.netname);
  1226.             bprint (" was telefragged by ");
  1227.             bprint (attacker.owner.netname);
  1228.             bprint ("\n");
  1229.  
  1230.             attacker.owner.frags = attacker.owner.frags + 1;
  1231.             return;
  1232.         }
  1233.  
  1234.         if (attacker.classname == "teledeath2")
  1235.         {
  1236.             bprint ("Satan's power deflects ");
  1237.             bprint (targ.netname);
  1238.             bprint ("'s telefrag\n");
  1239.  
  1240.             targ.frags = targ.frags - 1;
  1241.             return;
  1242.         }
  1243.     
  1244.         if (attacker.classname == "holo") // Blown to bits by a hologram
  1245.         {
  1246.             if (targ == attacker.owner)
  1247.             {
  1248.             bprint (targ.netname);
  1249.             bprint (" blew himself and his hologram skyhigh");
  1250.             attacker.owner.frags = attacker.owner.frags - 1;        
  1251.             return;
  1252.             }
  1253.             else
  1254.             {
  1255.             bprint (targ.netname);
  1256.             bprint (" looked to closely at ");
  1257.             bprint (attacker.owner.netname);
  1258.             bprint ("'s hologram.");
  1259.             attacker.owner.frags = attacker.owner.frags + 1;        
  1260.             return;
  1261.             }
  1262.         }
  1263.  
  1264.         if (attacker.classname == "player")
  1265.         {
  1266.             if (targ == attacker)
  1267.             {
  1268.                 // killed self
  1269.                 attacker.frags = attacker.frags - 1;
  1270.                 bprint (targ.netname);
  1271.                 
  1272.                 if (targ.weapon == 64 && targ.waterlevel > 1)
  1273.                 {
  1274.                     bprint (" discharges into the water.\n");
  1275.                     return;
  1276.                 }
  1277.                 if (targ.weapon == IT_GRENADE_LAUNCHER)
  1278.                     bprint (" tries to put the pin back in\n");
  1279.                 else
  1280.                     bprint (" becomes bored with life\n");
  1281.                 return;
  1282.             }
  1283.             else if ( (teamplay == 2) && (targ.team > 0)&&(targ.team == attacker.team) )
  1284.             {
  1285.                 if (rnum < 0.25)
  1286.                     deathstring = " mows down a teammate\n";
  1287.                 else if (rnum < 0.50)
  1288.                     deathstring = " checks his glasses\n";
  1289.                 else if (rnum < 0.75)
  1290.                     deathstring = " gets a frag for the other team\n";
  1291.                 else
  1292.                     deathstring = " loses another friend\n";
  1293.                 bprint (attacker.netname);
  1294.                 bprint (deathstring);
  1295.                 attacker.frags = attacker.frags - 1;
  1296.                 return;
  1297.             }
  1298.             else
  1299.             {
  1300.                 attacker.frags = attacker.frags + 1;
  1301.  
  1302.                 rnum = attacker.weapon;
  1303.                 if (rnum == IT_AXE)
  1304.                 {
  1305.                     deathstring = " was ax-murdered by ";
  1306.                     deathstring2 = "\n";
  1307.                 }
  1308.                 if (rnum == IT_SHOTGUN)
  1309.                 {
  1310.                     deathstring = " chewed on ";
  1311.                     deathstring2 = "'s boomstick\n";
  1312.                 }
  1313.                 if (rnum == IT_SUPER_SHOTGUN)
  1314.                 {
  1315.                     deathstring = " ate 2 loads of ";
  1316.                     deathstring2 = "'s buckshot\n";
  1317.                 }
  1318.                 if (rnum == IT_NAILGUN)
  1319.                 {
  1320.                     deathstring = " was nailed by ";
  1321.                     deathstring2 = "\n";
  1322.                 }
  1323.                 if (rnum == IT_SUPER_NAILGUN)
  1324.                 {
  1325.                     deathstring = " was punctured by ";
  1326.                     deathstring2 = "\n";
  1327.                 }
  1328.                 if (rnum == IT_GRENADE_LAUNCHER)
  1329.                 {
  1330.                     deathstring = " eats ";
  1331.                     deathstring2 = "'s pineapple\n";
  1332.                     if (targ.health < -40)
  1333.                     {
  1334.                         deathstring = " was gibbed by ";
  1335.                         deathstring2 = "'s grenade\n";
  1336.                     }
  1337.                 }
  1338.                 if (rnum == IT_ROCKET_LAUNCHER)
  1339.                 {
  1340.                     deathstring = " rides ";
  1341.                     deathstring2 = "'s rocket\n";
  1342.                     if (targ.health < -40)
  1343.                     {
  1344.                         deathstring = " was gibbed by ";
  1345.                         deathstring2 = "'s rocket\n" ;
  1346.                     }
  1347.                 }
  1348.                 if (rnum == IT_LIGHTNING)
  1349.                 {
  1350.                     deathstring = " accepts ";
  1351.                     if (attacker.waterlevel > 1)
  1352.                         deathstring2 = "'s discharge\n";
  1353.                     else
  1354.                         deathstring2 = "'s shaft\n";
  1355.                 }
  1356.                 bprint (targ.netname);
  1357.                 bprint (deathstring);
  1358.                 bprint (attacker.netname);
  1359.                 bprint (deathstring2);
  1360.             }
  1361.             return;
  1362.         }
  1363.         else
  1364.         {
  1365.             targ.frags = targ.frags - 1;
  1366.             bprint (targ.netname);
  1367.  
  1368.             // killed by a montser?
  1369.             if (attacker.flags & FL_MONSTER)
  1370.             {
  1371.                 if (attacker.classname == "monster_army")
  1372.                     bprint (" was shot by a Grunt\n");
  1373.                 if (attacker.classname == "monster_demon1")
  1374.                     bprint (" was eviscerated by a Fiend\n");
  1375.                 if (attacker.classname == "monster_dog")
  1376.                     bprint (" was mauled by a Rottweiler\n");
  1377.                 if (attacker.classname == "monster_dragon")
  1378.                     bprint (" was fried by a Dragon\n");
  1379.                 if (attacker.classname == "monster_enforcer")
  1380.                     bprint (" was blasted by an Enforcer\n");
  1381.                 if (attacker.classname == "monster_fish")
  1382.                     bprint (" was fed to the Rotfish\n");
  1383.                 if (attacker.classname == "monster_hell_knight")
  1384.                     bprint (" was slain by a Death Knight\n");
  1385.                 if (attacker.classname == "monster_knight")
  1386.                     bprint (" was slashed by a Knight\n");
  1387.                 if (attacker.classname == "monster_ogre")
  1388.                     bprint (" was destroyed by an Ogre\n");
  1389.                 if (attacker.classname == "monster_oldone")
  1390.                     bprint (" became one with Shub-Niggurath\n");
  1391.                 if (attacker.classname == "monster_shalrath")
  1392.                     bprint (" was exploded by a Vore\n");
  1393.                 if (attacker.classname == "monster_shambler")
  1394.                     bprint (" was smashed by a Shambler\n");
  1395.                 if (attacker.classname == "monster_tarbaby")
  1396.                     bprint (" was slimed by a Spawn\n");
  1397.                 if (attacker.classname == "monster_vomit")
  1398.                     bprint (" was vomited on by a Vomitus\n");
  1399.                 if (attacker.classname == "monster_wizard")
  1400.                     bprint (" was scragged by a Scrag\n");
  1401.                 if (attacker.classname == "monster_zombie")
  1402.                     bprint (" joins the Zombies\n");
  1403.  
  1404.                 return;
  1405.             }
  1406.  
  1407.             // tricks and traps
  1408.  
  1409.             // Came to close to an explosive Hologram
  1410.  
  1411.             if (attacker.classname == "explo_box")
  1412.             {
  1413.                 bprint (" blew up\n");
  1414.                 return;
  1415.             }
  1416.             if (attacker.solid == SOLID_BSP && attacker != world)
  1417.             {    
  1418.                 bprint (" was squished\n");
  1419.                 return;
  1420.             }
  1421.             if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter")
  1422.             {
  1423.                 bprint (" was spiked\n");
  1424.                 return;
  1425.             }
  1426.             if (attacker.classname == "fireball")
  1427.             {
  1428.                 bprint (" ate a lavaball\n");
  1429.                 return;
  1430.             }
  1431.             if (attacker.classname == "trigger_changelevel")
  1432.             {
  1433.                 bprint (" tried to leave\n");
  1434.                 return;
  1435.             }
  1436.  
  1437.             // in-water deaths
  1438.             rnum = targ.watertype;
  1439.             if (rnum == -3)
  1440.             {
  1441.                 if (random() < 0.5)
  1442.                     bprint (" sleeps with the fishes\n");
  1443.                 else
  1444.                     bprint (" sucks it down\n");
  1445.                 return;
  1446.             }
  1447.             else if (rnum == -4)
  1448.             {
  1449.                 if (random() < 0.5)
  1450.                     bprint (" gulped a load of slime\n");
  1451.                 else
  1452.                     bprint (" can't exist on slime alone\n");
  1453.                 return;
  1454.             }
  1455.             else if (rnum == -5)
  1456.             {
  1457.                 if (targ.health < -15)
  1458.                 {
  1459.                     bprint (" burst into flames\n");
  1460.                     return;
  1461.                 }
  1462.                 if (random() < 0.5)
  1463.                     bprint (" turned into hot slag\n");
  1464.                 else
  1465.                     bprint (" visits the Volcano God\n");
  1466.                 return;
  1467.             }
  1468.  
  1469.             // fell to their death?
  1470.             if (targ.deathtype == "falling")
  1471.             {
  1472.                 targ.deathtype = "";
  1473.                 bprint (" fell to his death\n");
  1474.                 return;
  1475.             }
  1476.  
  1477.             // hell if I know; he's just dead!!!
  1478.             bprint (" died\n");
  1479.         }
  1480.     }
  1481. };
  1482.